package com.controller.gw;

import com.common.paging.PagingData;
import com.dto.excution.ListExcution;
import com.entity.GwYYInfo;
import com.enums.ListEnum;
import com.service.GwService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2019/3/15 0015.
 */
@RestController
@RequestMapping("/gw")
public class GwController {
    @Autowired
    private GwService service;

    @ApiOperation(value = "官网插入yy")
    @PostMapping(value = "/insertYY")
    @ResponseBody
    public ListExcution<Void> insertYY(String phone,String yclass,String subjectId){
        int success = service.insertYY(phone,yclass,subjectId);
        if(success == 1){
            return new ListExcution<Void>(null, ListEnum.SUCCESS);
        }else if(success == -1){
            return new ListExcution<Void>(null, ListEnum.BINDISNO);
        }else{
            return new ListExcution<Void>(null, ListEnum.FAIL);
        }
    }

    @ApiOperation(value = "后台管理官网预约")
    @PostMapping(value = "/findYY")
    @ResponseBody
    public PagingData findYY(Integer page, Integer length) {
        PagingData pagingData = service.findYY(page,length);
        return pagingData;
    }
}
